<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>一串跟着鼠标的div</title>
   <style>
   div{width:20px;height:20px;background:red;position:absolute;}
   
   </style>
   <script>
   function getPost(ev){
      var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
	  var scrollLeft=document.documentElement.scrollLeft||document.body.scrollLeft;
	  return {x:ev.clientX+scrollLeft,y:ev.clientY+scrollTop};
   }
   document.onmousemove=function(ev){
      var aDiv=document.getElementsByTagName("div");
	  var oEvent=ev||event;
	  var pos=getPost(oEvent);
	  for(var i=aDiv.length-1;i>0;i--){
	      aDiv[i].style.left=aDiv[i-1].offsetLeft+"px";
		  aDiv[i].style.top=aDiv[i-1].offsetTop+"px";
	  }
      aDiv[0].style.left=pos.x+'px';
	  aDiv[0].style.top=pos.y+'px';
   }
   </script>
</head>
<body>
  <div>1</div>
  <div>2</div>
    <div>3</div>
	<div>4</div>
	<div>5</div>
	<div>6</div>
	<div>7</div>
	<div>8</div>
	<div>9</div>
	<div>0</div>

</body>
</html>